package com.wits.qso.entity;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.Parameter;

import com.wits.platform.entity.BaseEntity;

@Entity
@Table(name="qso_stuaid")
public class StuAid extends BaseEntity {
	private static final long serialVersionUID = 1L;
	
	/**课件代码*/
	private String id;
	/**学生ID*/
	private Student stuid;
	/**课件名称*/
	private String name;
	/**课件路径*/
	private String path;
	/**课件说明*/
	private String intro;
	/**是否共享*/
	private String share;
	
	@Id
	@GenericGenerator(name = "idGen", 
					strategy = "com.wits.platform.common.id.generator.IDGenerator",
					parameters={ 
								@Parameter(name = "segment_value", value = "QSO_STUAID_ID"), 
								@Parameter(name="table_name",value="wits_id_generator"),
								@Parameter(name="value_column_name",value="gen_value"),
								@Parameter(name="segment_column_name",value="gen_name"),
								@Parameter(name="segment_value_length",value="5"),
								@Parameter(name="sq_format",value="%03d"), 
								@Parameter(name="sq_prefix",value="SAID") 
					})
	@GeneratedValue(generator = "idGen")
	@Column(name = "stuaid_id", nullable = false, insertable = true, updatable = false, length = 10)
	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	@ManyToOne
	@JoinColumn(name="stu_id")
	public Student getStuid() {
		return stuid;
	}

	public void setStuid(Student stuid) {
		this.stuid = stuid;
	}

	@Column(name="stuaid_name",length=100)
	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@Column(name="stuaid_path",length=1000)
	public String getPath() {
		return path;
	}

	public void setPath(String path) {
		this.path = path;
	}

	@Column(name="stuaid_intro",length=500)
	public String getIntro() {
		return intro;
	}

	public void setIntro(String intro) {
		this.intro = intro;
	}

	@Column(name="stuaid_share",length=2)
	public String getShare() {
		return share;
	}

	public void setShare(String share) {
		this.share = share;
	}

	@Override
	public String display() {
		// TODO Auto-generated method stub
		return null;
	}
	
	@Override
	public String toString(){
		return "{\"id\":\"" + this.id 
				+ "\",\"stuname\":\"" +this.stuid.getStuName()
				+ "\",\"name\":\"" + this.name 
				+ "\",\"share\":\"" + this.share
				+ "\",\"intro\":\"" + this.intro
				+ "\",\"remark\":\"" + this.remark
				+ "\" }";
	}

}
